Recording and Playing Macros
You can record macros in Dragonfly to automate frequently used commands or processes, which can help you save time by streamlining repetitive tasks. After you record a macro, you can play it back to perform all of the steps in the macro with a single action, unless a user input is required.
Macro Player dialog

The following controls are available on the Macro Player for recording and playing macros.
|
Icon |
Description |
---|---|---|
New Macro |
|
Opens the Create Macro File dialog, shown below.
You can choose a name for the new macro, a save location, and to either create the file or to create the file and start recording. |
Import Macro |
|
Lets you import a macro file to the current user macro folder. |
View File |
|
Opens the current macro file. Note Macro files are written in Python and can be viewed and edited in a simple text editor or with a developer application such as PyCharm. |
Save As |
|
Saves the current macro as a new file. |
Save |
|
Saves any changes you made to the current macro. |
Reload |
|
Reloads the selected macro. Note You can reload a macro to discard any changes you made while editing the macro in the Macro Player dialog. Reloading a macro will also apply any changes you made to the macro file externally. For example, in PyCharm. |
Delete |
|
Deletes the selected macro. |
Record |
|
Begins recording. Note The Record button changes to Pause as soon as you begin recording. |
Pause |
|
Pauses recording. Note The Pause button changes to Record as soon as you pause recording. |
Play Single Step |
|
Plays the macro step-by-step. |
Play All |
|
Plays the macro, either to the end or to point that a user input is required. If the Automatically select the only occurrence when there is a single element available option is checked, the macro will automatically insert the required object or element when needed if no additional options are available. If multiple elements are available, the macro will wait for the required user input. |
Stop |
|
Stops playback. |

You can record macros in the Macro Player dialog to automate frequently used commands or processes. You should note that while it is possible to record a macro for almost any action that applies to Dragonfly, some features may be disabled when you are recording. This is because some actions require considerable user input and are too difficult to automate.

- Make sure that all the objects — image data, regions of interest, meshes, and so on — that you plan to include in your macro are readily accessible in the workspace.
- Choose Utilities > Macro Player on the menu bar.
The Macro Player dialog opens.
- Click the New
button.
The Create Macro File dialog appears.
- Enter a name for your new macro in the Create Macro File dialog.
Note When naming or renaming a macro, you should use a unique name whenever possible. However, you should note that each macro is assigned a unique identifier (UID) and unique names are not required.
- Choose an accessibility option for your macro — Current user or All users.
- Macros for the current user are saved to the
AppData\Local\ORS\DragonflyXX\pythonUserExtensions\Macros
folder on your computer. - Macros for all users are saved to the
ProgramData\ORS\DragonflyXX\pythonAllUsersExtensions\Macros
folder on your computer.
- Macros for the current user are saved to the
- Do one of the following:
- Click the Create file button. In this case you will then need to click the Record
button to begin recording.
- Click the Create file and start recording button. If you select this option recording will be begin immediately.
- Click the Create file button. In this case you will then need to click the Record
- Perform the steps you want to record for the macro. Dragonfly will automatically capture each of the steps.
- Click the Stop
button when you have completed all the steps that you want to record.
This stops recording and saves all of the completed steps.
You can edit specific steps (see Editing Macros), execute the macro (see Executing Macros), as well as play back the macro (see Playing Macros).
- Expand the About macro box and then enter additional information about your macro in the Current tab, optional.
- You can add information about the macro, such as an explanation of the input steps and guidelines for selecting required parameters, in the General documentation field.
- You can update the author and contact information, as well as the copyright and date of creation.
- You can modify the version number in the Version text box.
- Click the Save
button if you made any changes to your macro after you stopped recording.

Each step in a recorded macro includes its name or title and a brief description of the action to be executed. You can set steps to be executed automatically, to wait for user input, or to be skipped. You can also edit the parameters of each step in the Parameter editor.
You should that the Macro Player features an expandable tree view that lets you dive-into macro blocks extracted from object histories (see Extracting Object Histories) and for macros that call other macros. As shown below, you can expand a block to view each individual step within it.
Macro Player dialog

The following controls are available for editing the steps in a recorded macro.
|
Icon |
Description |
---|---|---|
Execute |
|
When a macro step is set to Execute, the step will be executed automatically. |
Pause |
|
When a macro step is set to Pause, the macro will stop at the paused step and wait for a user input. |
Skip |
|
When a macro step is set to Skip, the macro will skip the step and continue playback. |
Delete |
|
Deletes the selected macro step. |
You can use the controls in the Parameter editor, shown below, to edit any step in a logged operation.
Parameter editor

- Choose Utilities > Macro Player on the menu bar.
The Macro Player dialog opens.
- Select the macro that you want to edit from the drop-down menu.
- Select the step that you want to edit.
- Do the following, as required:
- Change the execution of the step with the step controls.
- Edit the description of the step.
- Edit the parameters of the selected step in the Parameter editor.
- Click the Save
button.
You can save your changes to the current macro file or create a new file.

After you record a macro, you can play it back. Playing back a macro automatically runs all of the interface actions you recorded using a single action, unless a user input is required.

- Choose Utilities > Macro Player on the menu bar.
The Macro Player dialog opens.
- Select the macro that you want to run from the drop-down menu.
- Do one of the following:
- Click the Play Single Step
button to play the macro step-by-step.
- Click the Play All
button to play all the steps in the macro or until a user input is required.
In this case, the Stop macro execution dialog will appear onscreen while the macro plays. You can choose to pause or stop the macro in the dialog.
Note If an input is required, it will appear at the bottom of the Macro Player, as shown below.
- Click the Play Single Step
- Click the Stop
button when the macro is finished playing.

After you record a macro, you can execute it from the Data Properties and Settings pop-up menu or from the View pop-up menu. Executing a macro automatically runs all of the interface actions you recorded using a single action, unless an input is required.

A number of configured actions and keyboard shortcuts are available for the Macro Player and Macro Builder. The default settings for these actions are listed in the following table.
Action |
Key |
Mouse |
---|---|---|
Open the Macro Builder |
- |
- |
Open the Macro Player |
- |
- |